*******************************************************
*Trade shock effects on globam theil + export intensity
*******************************************************
*
use temp1_nonmfg,clear
eststo clear
keep if theilw_d1 !=.
global depvar = "ltotexport"
global extensive = "lnbnc8"

global depvar_d1 = "$depvar"+"_d1"
global extensive_d1 = "$extensive"+"_d1"
*
*skewness
eststo: xtreg  theilw  ltradeshock3     yd*, robust cluster(firmid) fe i(firmid)
eststo: reg 	theilw_d1   ltradeshock6  yd*, robust cluster(firmid)
eststo: xtreg   theilw_d1   ltradeshock6  yd*, robust cluster(firmid)  fe i(firmid)
*
*export intensity reacts to shocks
eststo: xtreg  exportintenscur  ltradeshock3     yd*, robust cluster(firmid) fe i(firmid)
eststo: reg 	exportintens_d1   ltradeshock6  yd*, robust cluster(firmid)
eststo: xtreg   exportintens_d1   ltradeshock6  yd*, robust cluster(firmid)  fe i(firmid)
*
log using $DIRLOG/Replication/tab-FirstStageGlobal_rev_nonmfg.txt, text append
set linesize 250
esttab, drop(yd*) b(%4.3f) se(%4.3f) r2 starlevels({$^c$} 0.1 {$^b$} 0.05 {$^a$} 0.01)  tex  title() label
esttab, drop(yd*) compress r2 starlevels(c 0.1 b 0.05 a 0.01)  b(%4.3f) se(%4.3f)
*output the results in a tex file directly inputable in the text
esttab using $DIRLOG/Replication/tab-FirstStageGlobal_rev_input_nonmfg.tex, b(%4.3f) se(%4.3f)  starlevels({$^c$} 0.1 {$^b$} 0.05 {$^a$} 0.01)    ///
nocons drop(yd* _cons)  label tex substitute(\_ _) fragment replace nodepvars nonumbers nomtitles nogaps nolines eqlabels(none)
eststo clear
log close

